" <item>"
" <attribute name='label'>_New</attribute>"
" <attribute name='action'>app.new</attribute>"
- " <attribute name='accel'><Primary>n</attribute>"
" </item>"
" <item>"
" <attribute name='label'>_Open</attribute>"
" <item>"
" <attribute name='label'>_Save</attribute>"
" <attribute name='action'>app.save</attribute>"
- " <attribute name='accel'><Primary>s</attribute>"
" </item>"
" <item>"
" <attribute name='label'>Save _As...</attribute>"
" <attribute name='action'>app.save-as</attribute>"
- " <attribute name='accel'><Primary>s</attribute>"
" </item>"
" </section>"
" <section>"
" <item>"
" <attribute name='label'>_Quit</attribute>"
" <attribute name='action'>app.quit</attribute>"
- " <attribute name='accel'><Primary>q</attribute>"
" </item>"
" </section>"
" </submenu>"
" <item>"
" <attribute name='label'>_About Print Editor</attribute>"
" <attribute name='action'>app.about</attribute>"
- " <attribute name='accel'><Primary>a</attribute>"
" </item>"
" </section>"
" </submenu>"
{
GtkBuilder *builder;
GMenuModel *menubar;
+ struct {
+ const char *action_and_target;
+ const char *accelerators[2];
+ } accels[] = {
+ { "app.new", { "<Control>n", NULL } },
+ { "app.quit", { "<Control>q", NULL } },
+ { "app.save", { "<Control>s", NULL } },
+ { "app.about", { "<Control>a", NULL } },
+ };
builder = gtk_builder_new ();
gtk_builder_add_from_string (builder, ui_info, -1, NULL);
gtk_application_set_menubar (GTK_APPLICATION (app), menubar);
+ for (int i = 0; i < G_N_ELEMENTS (accels); i++)
+ gtk_application_set_accels_for_action (GTK_APPLICATION (app), accels[i].action_and_target, accels[i].accelerators);
+
g_object_unref (builder);
}